package com.cs.study.homework._0219;

public class Demo {
    public static void main(String[] args) {
        Account account = new Account();
        account.printAccount();
    }
}

class Account {
    private String userName;
    private String password;
    private double balance;

    public void setUserName(String userName) {
        if (userName.length() >= 4 && userName.length() <= 6) {
            this.userName = userName;
        }
        System.out.println("用户名不合法!");
    }

    public void setPassword(String password) {
        if (password.length() == 6) {
            this.password = password;
        }
        System.out.println("密码不合法！");
    }

    public void setBalance(double balance) {
        if (balance > 100) {
            this.balance = balance;
        }
        System.out.println("余额错误！");
    }

    public String getUserName() {
        return userName;
    }

    public String getPassword() {
        return password;
    }

    public double getBalance() {
        return balance;
    }

    public void printAccount(){
        System.out.println("用户名：" + userName + " 密码：" + password + " 余额：" + balance);
    }
}